<?php
/**
 * This file is part of PHPlaza (xhttp://code.google.com/p/phplaza)
 * This file is licensed under the GNU Lesser General Public License
 *      http://www.gnu.org/licenses/lgpl.html
 *
 * No warranty is given, express or implied. Use at your own risk.
 */
 
namespace application;

class DefaultPage extends core::Page
{
	public function __construct()
	{
		parent::__construct();
		
		$this->setId('application.DefaultPage');
	}
	
	public function initialize()
	{
		parent::initialize();
		
		$headline = new core::components::TextComponent();
		$headline->setId('headline');
		$headline->setText('<h1>Hallo Welt!</h1>');
		$this->addChild($headline);
		
		$form = new core::components::Form();
		$form->setId('form');
		$this->addChild($form);
		
		$button = new core::components::Button();
		$button->setId('bttn1');
		$button->setText('Click me');
		$button->addOnClick(array($this, 'bttn1_click'));
		$form->addChild($button);
	}
	
	public function bttn1_click($sender, $data)
	{
		$sender->setText('Thanks for clicking');
	}
}